let str = 'hello world hello';
console.log(str.replaceAll("hello", "haha"));
// haha world haha

str = 'aaaabbbbaaaabbbb';
console.log(str.replaceAll(/b{4}/g, "wwww"));
// aaaawwwwaaaawwww
